package cn.hahah.module.blog.dal.mysql.usercomment;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.usercomment.UserCommentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.usercomment.vo.*;

/**
 * 用户评论文章 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserCommentMapper extends BaseMapperX<UserCommentDO> {

    default PageResult<UserCommentDO> selectPage(UserCommentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserCommentDO>()
                .eqIfPresent(UserCommentDO::getId, reqVO.getId())
                .eqIfPresent(UserCommentDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserCommentDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(UserCommentDO::getContent, reqVO.getContent())
                .betweenIfPresent(UserCommentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserCommentDO::getId));
    }

}